#pragma once

#include <include/core/SkTypeface.h>

#include "ranges.h"

struct hb_blob_t;

class Typeface {
public:
    Typeface(SkTypeface *tf);
    Typeface(sk_sp<SkTypeface> tf);
    ~Typeface();

    std::string GetPostScriptName();
    bool Has(uint32_t ch);
    sk_sp<SkTypeface> Get() const { return typeface_; }

private:
    int InitCmap();
    int ParseCmap();

    sk_sp<SkTypeface> typeface_ = nullptr;
    SkString name_;
    hb_blob_t *hblob_ = nullptr;
    bool isCmapInited = false;
    bool isCmapParsed = false;
    Ranges ranges_;
};
